//
//  GQHDriverAuthorizationInfoController.m
//  Xanthium
//
//  Created by GuanQinghao on 31/03/2018.
//  Copyright © 2018 GuanQinghao. All rights reserved.
//

#pragma mark Macro
#import "GQHHeader.h"

#pragma mark Model

#pragma mark Object

#pragma mark View
#import "GQHDriverAuthorizationInfoView.h"

#pragma mark Controller
#import "GQHDriverAuthorizationInfoController.h"

#pragma mark CocoaPods

#pragma mark ----------Header End----------

@interface GQHDriverAuthorizationInfoController () {
    
#pragma mark Data
    
#pragma mark View
    /// 自定义根视图
    GQHDriverAuthorizationInfoView *rootView;
}

@end


@implementation GQHDriverAuthorizationInfoController

#pragma mark --Lifecycle
- (void)loadView {
    DLog();
    
    rootView = [[GQHDriverAuthorizationInfoView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.view = rootView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    DLog();
    
    [self loadLocalData];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    DLog();
    
    self.qh_titleLabel.text = @"司机认证信息";
    [self.qh_rightButton setHidden:YES];
    self.automaticallyAdjustsScrollViewInsets = NO;
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    DLog();
    
}

#pragma mark --Delegate

#pragma mark --TargetMethod

#pragma mark --PrivateMethod
- (void)loadLocalData {
    
    NSMutableArray *contentArray = [NSMutableArray arrayWithCapacity:20];
    
    // 联系人
    NSString *empName = [_qh_authorizationInfo objectForKey:@"empName"];
    [contentArray qh_safetySetObject:empName atIndex:0];
    
    // 联系电话
    NSString *phoneNum = [_qh_authorizationInfo objectForKey:@"phoneNum"];
    [contentArray qh_safetySetObject:phoneNum atIndex:1];
    
    // 身份证号码
    NSString *dirIdCard = [_qh_authorizationInfo objectForKey:@"dirIdCard"];
    [contentArray qh_safetySetObject:dirIdCard atIndex:2];
    
    // 从业资格证号码
    NSString *qualCerNum = [_qh_authorizationInfo objectForKey:@"qualCerNum"];
    [contentArray qh_safetySetObject:qualCerNum atIndex:3];
    
    // 身份证正面
    NSString *positiveIdCard = [NSString stringWithFormat:@"%@%@",[NSString qh_imageURLString],[_qh_authorizationInfo objectForKey:@"positiveIdCard"]];
    [contentArray qh_safetySetObject:positiveIdCard atIndex:4];
    
    // 身份证反面
    NSString *backIdCard = [NSString stringWithFormat:@"%@%@",[NSString qh_imageURLString],[_qh_authorizationInfo objectForKey:@"backIdCard"]];
    [contentArray qh_safetySetObject:backIdCard atIndex:5];
    
    // 驾驶证照片
    NSString *qrivingLicPhoto = [NSString stringWithFormat:@"%@%@",[NSString qh_imageURLString],[_qh_authorizationInfo objectForKey:@"qrivingLicPhoto"]];
    [contentArray qh_safetySetObject:qrivingLicPhoto atIndex:6];
    
    // 从业资格证照片
    NSString *qualCerPhoto = [NSString stringWithFormat:@"%@%@",[NSString qh_imageURLString],[_qh_authorizationInfo objectForKey:@"qualCerPhoto"]];
    [contentArray qh_safetySetObject:qualCerPhoto atIndex:7];
    
    // 所有人
    NSString *carUser = [_qh_authorizationInfo objectForKey:@"carUser"];
    [contentArray qh_safetySetObject:carUser atIndex:8];
    
    // 所有人证件号
    NSString *ownerIdNum = [_qh_authorizationInfo objectForKey:@"ownerIdNum"];
    [contentArray qh_safetySetObject:@"" atIndex:9];
    
    // 道路经营许可证号
    NSString *roadTraBuLicNum = [_qh_authorizationInfo objectForKey:@"roadTraBuLicNum"];
    [contentArray qh_safetySetObject:roadTraBuLicNum atIndex:10];
    
    // 道路运输许可证号
    NSString *roadTraCerNum = [_qh_authorizationInfo objectForKey:@"roadTraCerNum"];
    [contentArray qh_safetySetObject:roadTraCerNum atIndex:11];
    
    // 道路运输许可证
    NSString *roadTraCerLic = [NSString stringWithFormat:@"%@%@",[NSString qh_imageURLString],[_qh_authorizationInfo objectForKey:@"roadTraCerLic"]];
    [contentArray qh_safetySetObject:roadTraCerLic atIndex:12];
    
    // 行驶证
    NSString *carQrivingLicPhoto = [NSString stringWithFormat:@"%@%@",[NSString qh_imageURLString],[_qh_authorizationInfo objectForKey:@"carQrivingLicPhoto"]];
    [contentArray qh_safetySetObject:carQrivingLicPhoto atIndex:13];
    
    // 车牌号
    NSString *licPlateNum = [_qh_authorizationInfo objectForKey:@"licPlateNum"];
    [contentArray qh_safetySetObject:licPlateNum atIndex:14];
    
    // 挂车牌照号
    NSString *trailerRegistrationNum = [_qh_authorizationInfo objectForKey:@"trailerRegistrationNum"];
    if (![trailerRegistrationNum isKindOfClass:[NSNull class]]) {
        
        [contentArray qh_safetySetObject:trailerRegistrationNum atIndex:15];
    } else {
        
        [contentArray qh_safetySetObject:@"" atIndex:15];
    }
    
    // 车型
    NSString *vehicleclassificationcode = [_qh_authorizationInfo objectForKey:@"vehicleclassificationcode"];
    [contentArray qh_safetySetObject:vehicleclassificationcode atIndex:16];
    
    // 车长
    NSString *carLength = [_qh_authorizationInfo objectForKey:@"carLength"];
    [contentArray qh_safetySetObject:carLength atIndex:17];
    
    // 载重
    NSString *carLoad = [_qh_authorizationInfo objectForKey:@"carLoad"];
    [contentArray qh_safetySetObject:carLoad atIndex:18];
    
    // 车辆照片
    NSString *carPhoto = [_qh_authorizationInfo objectForKey:@"carPhoto"];
    [contentArray qh_safetySetObject:carPhoto atIndex:19];
    
    rootView.qh_contentArray = contentArray;
    [rootView.qh_tableView reloadData];
}

#pragma mark --Setter

#pragma mark --Getter

#pragma mark --View

@end
